package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 员工出入房间统计表
 *
 * @author ytche
 * @date 2017年6月30日
 *
 */
@Entity
@JsonApiResource(type = "personLocationIoReport")
@Table(name = "tnb_person_location_io_report")
public class PersonLocationIoReport extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Employee employee;// 员工
	private Room room;// 房间
	private Integer generatorTime;// 统计时间
	private Integer inTime;// 进入房间时间
	private Integer outTime;// 出房间时间

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "employee_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "room_id", foreignKey = @ForeignKey(name = "null"))
	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	@Column(name = "generator_time")
	public Integer getGeneratorTime() {
		return generatorTime;
	}

	public void setGeneratorTime(Integer generatorTime) {
		this.generatorTime = generatorTime;
	}

	@Column(name = "in_time")
	public Integer getInTime() {
		return inTime;
	}

	public void setInTime(Integer inTime) {
		this.inTime = inTime;
	}

	@Column(name = "out_time")
	public Integer getOutTime() {
		return outTime;
	}

	public void setOutTime(Integer outTime) {
		this.outTime = outTime;
	}
}
